#!/usr/bin/python
# -*- coding: utf-8 -*-
# @version        : 1.0
# @Create Time    : 2024/8/16 10:07
# @File           : task
# @IDE            : PyCharm
# @desc           : 描述

from sqlalchemy import Boolean, ForeignKey, String, Text
from sqlalchemy.orm import Mapped, mapped_column, relationship

from db.db_base import BaseModel, AuditModel


class DCTaskFeedback(AuditModel):
    __tablename__ = "dc_dispatch_feedback"
    __table_args__ = ({'comment': '任务执行问题反馈'})

    ticket_id: Mapped[int] = mapped_column(
        String(50),
        ForeignKey("dc_dispatch_task.ticket_id", ondelete="CASCADE"),
        comment="工单ID"
    )
    task = relationship("DCTask", foreign_keys=ticket_id, back_populates="feedback")

    title: Mapped[str] = mapped_column(String(100), index=True, nullable=False, comment="标题")
    content: Mapped[str] = mapped_column(Text, comment="内容")

    remark: Mapped[str] = mapped_column(Text, nullable=True, comment="备注")
    is_active: Mapped[bool] = mapped_column(Boolean, default=True, comment="是否可见")
